﻿using Apps.Common;
using Apps.DAL.YANX;
using Apps.IBLL.YANX;
using Apps.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Apps.BLL.YANX
{
    public partial class YANX_RECORD_BLL : IYANX_RECORD_BLL
    {
        YANX_RECORD_Repository dal = new YANX_RECORD_Repository();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public YANX_RECORD Info(string id)
        {
            if (string.IsNullOrEmpty(id)) return new YANX_RECORD();
            return dal.Info(id);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="queryStr"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="sortFiled"></param>
        /// <param name="orderBy"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        public List<YANX_RECORD> GetList(string batchCode,string collectCode,string name, int pageIndex, int pageSize, string sortFiled, string orderBy, ref int totalCount)
        {
            return dal.GetList(batchCode, collectCode,name, pageIndex, pageSize, sortFiled, orderBy, ref totalCount);
        }

        /// <summary>
        /// 根据批次号 获取所有岩相文件
        /// </summary>
        /// <param name="batchCode"></param>
        /// <returns></returns>
        public List<YANX_RECORD> GetAllList(string batchCode)
        {
            return dal.GetAllList(batchCode);
        }

        /// <summary>
        /// 根据制样码获取批次码
        /// </summary>
        /// <param name="collectCode"></param>
        /// <returns></returns>
        public string GetBatchCode(string testCode)
        {
            return dal.GetBatchCode(testCode);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Add(YANX_RECORD model)
        {
            if (model == null) return false;
            return dal.Add(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Update(YANX_RECORD model)
        {
            if (model == null) return false;
            return dal.Update(model);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool Delete(string id)
        {
            if (string.IsNullOrEmpty(id)) return false;
            return dal.Delete(id);
        }

        /// <summary>
        /// 批量审核
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="examine"></param>
        /// <returns></returns>
        public bool ExamineData(List<string> ids, string examine)
        {
            return dal.ExamineData(ids, examine);
        }

        /// <summary>
        /// 更改采样状态
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="examine"></param>
        /// <returns></returns>
        public bool ExamineError(string samplingId, bool IEERROR)
        {
            return dal.ExamineError(samplingId, IEERROR);
        }

        /// <summary>
        /// 补录 样桶卡号 信息
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="examine"></param>
        /// <returns></returns>
        public bool BuChong(string samplingId, string rfid, string weight = "0", string isShouyang = "")
        {
            return dal.BuChong(samplingId, rfid, weight, isShouyang);
        }
    }
}
